package com.ssy.lingxi.member.merchant.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 国家省市及编码
 * @author 万宁
 * @version 2.0.0
 * @date 2020-08-20
 */
@Entity
@Table(schema = "public", name = "ms_mc_country_area", indexes = {@Index(name="ms_mc_country_area_code_idx", columnList = "code"), @Index(name="ms_mc_country_area_level_idx", columnList = "level"), @Index(name="ms_mc_country_area_pcode_idx", columnList = "pcode")})
public class CountryAreaDO implements Serializable {
    private static final long serialVersionUID = -2472502965014568940L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="country_area_seq")
    @SequenceGenerator(sequenceName="ms_mc_country_area_seq", name="country_area_seq",allocationSize = 1)
    private Long id;

    /**
     * 编码
     */
    @Column(columnDefinition = "varchar(20)")
    private String code;

    /**
     * 省市名称
     */
    @Column(columnDefinition = "varchar(100)")
    private String name;

    /**
     * 层级
     */
    @Column
    private Integer level;

    /**
     * 上级编码
     */
    @Column(name = "pcode", columnDefinition = "varchar(20)")
    private String parentCode;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getParentCode() {
        return parentCode;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        CountryAreaDO that = (CountryAreaDO) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
